package com.mengpeng.manim

import android.os.Bundle
import android.view.animation.AnticipateOvershootInterpolator
import androidx.appcompat.app.AppCompatActivity
import cn.coderdream.anim.MAnim
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)



        button1.setOnClickListener {

            MAnim.getInstance()
                .with(imageView)
                .scaleX(2000, 1f, 3f, 1f)
                .scaleY(2000, 1f, 4f, 1f)
                .scaleXY(2000, floatArrayOf(1f, 3f, 1f), floatArrayOf(1f, 4f, 1f))
                .alpha(2000, 1f, 0.1f, 1f)
                .rotationX(2000, 0f, 360f, 0f)
                .rotationY(2000, 0f, 360f, 0f)
                .rotationXY(2000, floatArrayOf(0f, 360f, 0f), floatArrayOf(0f, 120f, 0f))
                .rotation(2000, 0f, 720f, 0f)
                .translationX(2000, 0f, 300f, -300f, 0f)
                .translationY(2000, 0f, 300f, -300f, 0f)
                .translationXY(2000, floatArrayOf(0f, 360f, 0f), floatArrayOf(0f, 120f, 0f))
                .start()

            MAnim.getInstance().with(imageView)
                .translation(
                    3000,
                    AnticipateOvershootInterpolator(),
                    floatArrayOf(0f, 400f),
                    floatArrayOf(0f, 200f)
                )
                .call {

                }
                .rotation(3000, AnticipateOvershootInterpolator(), 0f, 360f)
                .start()
        }


    }
}
